<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateReviewFeedbackConfirmTable extends AbstractMigration
{
    public function up()
    {
        $table = $this->table('review_feedback_confirm', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '审核反馈实体表']);
        $table->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '主键ID'])
            ->addColumn('review_feedback_id', 'integer', ['limit' => 11, 'default' => 0, 'null' => false, 'comment' => '审核反馈id'])
            ->addColumn('user_id', 'integer', ['limit' => 11, 'null' => false, 'signed' => false, 'default' => 0, 'comment' => '用户id'])
            ->addColumn('confirm_at', 'integer', ['signed' => false, 'null' => false, 'default' => 0, 'limit' => 11, 'comment' => '确认时间'])
            ->addColumn('created', 'integer', ['signed' => false, 'null' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建时间']);
        $table->addIndex(['review_feedback_id', 'user_id'], ['name' => 'idx_review_feedback_user', 'type' => 'unique']);
        $table->create();

    }

    public function down()
    {
        $this->table('review_feedback_confirm')->drop()->save();
    }
}
